package com.wc.AlgoOJ_train.train1.c1.A113;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/12/26 10:58
 * Treasure the new start, freshmen!
 * http://43.138.190.70:8888/p/A113
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (n-- > 0) {
            double cs = 0;
            double sum = 0;
            int k = sc.nextInt();
            boolean flg = false;
            while (k-- > 0) {
                sc.next();
                int c = sc.nextInt();
                int s = sc.nextInt();
                if (s >= 0 && s < 60) {
                    flg = true;
                }
                cs += c;
                sum += c * s;
            }
            if (flg) {
                System.out.println("Sorry!");
            } else {
                System.out.printf("%.2f\n", sum / cs);
            }
            System.out.println();
        }
    }
}
